cardigan : cardigan.ml ast.mli parser.mly scanner.mll
	ocamllex scanner.mll
	ocamlyacc parser.mly
	ocamlc -c ast.mli
	ocamlc -c parser.mli
	ocamlc -c scanner.ml
	ocamlc -c parser.ml
	ocamlc -c cardigan.ml
	ocamlc -o cardigan parser.cmo scanner.cmo cardigan.cmo

alt : cardigan.ml ast2.mli parser.mly scanner.mll
	ocamllex scanner.mll
	ocamlyacc parser.mly
	ocamlc -c ast2.mli
	ocamlc -c parser.mli
	ocamlc -c scanner.ml
	ocamlc -c parser.ml
	ocamlc -c cardigan.ml
	ocamlc -o cardigan parser.cmo scanner.cmo cardigan.cmo

parser.cmi : ast.cmo

%.cmo : %.ml
	ocamlc -c $<

%.cmi : %.mli
	ocamlc -c $<

ast.cmo :
ast.cmx :

.PHONY : clean
clean :
	rm -f cardigan parser.ml parser.mli parser.output \
	scanner.ml testall.log *.cmo *.cmi *.out *.diff


.PHONY : test
test :
	./testall.sh


.PHONY : all
all : clean cardigan test

